package no.ntnu.idi.deid.statistical.tfidf;

import java.io.File;

import no.ntnu.idi.deid.documentunits.Sentence;
import no.ntnu.idi.deid.documentunits.Token;
import no.ntnu.idi.deid.preprocessor.Documents;

public class DocumentFrequencyMain {
	
	private TokenDocumentFrequency mTokenDocumentFrequency;
	private SentenceDocumentFrequency mSentenceDocumentFrequency;
	
	public DocumentFrequencyMain(Documents documents) {
		mSentenceDocumentFrequency = new SentenceDocumentFrequency(documents);
		mTokenDocumentFrequency = new TokenDocumentFrequency(documents);
	}
	
	public DocumentFrequencyMain(File sentenceIdfDataBasePath, File tokenIdfDatabasePath) {
		mSentenceDocumentFrequency = new SentenceDocumentFrequency(sentenceIdfDataBasePath);
		mTokenDocumentFrequency = new TokenDocumentFrequency(tokenIdfDatabasePath);
	}
			
	public void generateTokenDocumentFrequencyStats(String path) {
		mTokenDocumentFrequency.generateStatsDocument(path);
	}
		
	public void generateSentenceDocumentFrequencyStats(String path) {
		mSentenceDocumentFrequency.generateStatsDocument(path);
	}

	public boolean isSentenceTFIDFAboveThreshold(Sentence sentence,
			Double ifIdfLowerThreshold) {
		return mSentenceDocumentFrequency.isAboveTFIDFThreshold(sentence, ifIdfLowerThreshold);
	}
	
	public boolean isSentenceIDFAboveThreshold(Sentence sentence,
			Double ifIdfLowerThreshold) {
		return mSentenceDocumentFrequency.isAboveIDFThreshold(sentence, ifIdfLowerThreshold);
	}
	
	public boolean isTokenTFIDFAboveThreshold(Token token,
			Double ifIdfLowerThreshold) {
		return mTokenDocumentFrequency.isAboveTFIDFThreshold(token, ifIdfLowerThreshold);
	}
	
	public boolean isTokenIDFAboveThreshold(Token token,
			Double ifIdfLowerThreshold) {
		return mTokenDocumentFrequency.isAboveIDFThreshold(token, ifIdfLowerThreshold);
	}	
}
